package com.circle.interests.api.enums;

import lombok.Getter;

/**
 * @author zhou
 * @date 2021/1/15
 */
public enum PrizeSendCodeEnum {
    /**
     * 奖品发放编码
     */
    WIN_SUCCESS(1, "中奖成功"),
    NOT_ENOUGH(2, "库存不足"),
    RECEIVE_SUCCESS(2, "领取成功"),
    WRITE_OFF_ING(3, "核销中"),
    WRITE_OFF_SUCCESS(4, "核销成功");

    @Getter
    private final Integer code;
    @Getter
    private final String info;

    PrizeSendCodeEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static PrizeSendCodeEnum getByCode(Integer code) {
        return getByCode(code, null);
    }

    public static PrizeSendCodeEnum getByCode(Integer code, PrizeSendCodeEnum defaultValue) {
        for (PrizeSendCodeEnum e : PrizeSendCodeEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return defaultValue;
    }
}
